// 失物招领相关的TypeScript类型定义

import type { ResponseData } from '@/api/user/type'

// ============== 失物信息相关 ==============

// 失物信息
export interface LostItem {
  id: number
  userId: number
  userName?: string
  userAvatar?: string
  title: string
  description: string
  location: string
  foundTime: string
  category: string
  status: number // 0-待认领，1-已申领，2-已归还
  viewCount: number
  likeCount: number
  commentCount: number
  images: string[]
  isLiked?: boolean // 当前用户是否点赞
  createTime: string
  updateTime: string
}

// 发布失物表单数据
export interface PublishLostItemForm {
  title: string
  description: string
  location: string
  foundTime: string
  category: string
  images: File[]
}

// 失物列表查询参数
export interface LostItemQueryParams {
  page: number
  pageSize: number
  keyword?: string
  category?: string
  status?: number
  startTime?: string
  endTime?: string
}

// 失物列表响应数据
export interface LostItemListResponse extends ResponseData {
  data: {
    records: LostItem[]
    total: number
    page: number
    pageSize: number
  }
}

// 失物详情响应数据
export interface LostItemDetailResponse extends ResponseData {
  data: LostItem
}

// 发布失物响应数据
export interface PublishLostItemResponse extends ResponseData {
  data: {
    id: number
  }
}

// ============== 失物申领相关 ==============

// 申领表单数据
export interface ClaimForm {
  itemId: number
  reason: string
  contactInfo: string
}

// 申领记录
export interface ClaimRecord {
  id: number
  itemId: number
  userId: number
  userName?: string
  reason: string
  contactInfo: string
  status: number // 0-待审核，1-已通过，2-已拒绝
  adminRemark?: string
  createTime: string
  updateTime: string
}

// 申领响应数据
export interface ClaimResponse extends ResponseData {
  data?: string
}

// ============== 点赞相关 ==============

// 点赞响应数据
export interface LikeResponse extends ResponseData {
  data?: string
}

// ============== 评论相关 ==============

// 评论信息
export interface Comment {
  id: number
  itemId: number
  userId: number
  userName?: string
  userAvatar?: string
  content: string
  likeCount: number
  replyCount: number
  isLiked?: boolean
  replies?: Reply[]
  createTime: string
  updateTime: string
}

// 回复信息
export interface Reply {
  id: number
  commentId: number
  userId: number
  userName?: string
  userAvatar?: string
  replyToUserId?: number
  replyToUserName?: string
  content: string
  likeCount: number
  isLiked?: boolean
  createTime: string
}

// 评论表单数据
export interface CommentForm {
  itemId: number
  content: string
}

// 回复表单数据
export interface ReplyForm {
  commentId: number
  content: string
  replyToUserId?: number
}

// 评论列表响应数据
export interface CommentListResponse extends ResponseData {
  data: {
    records: Comment[]
    total: number
  }
}

// 评论响应数据
export interface CommentResponse extends ResponseData {
  data?: {
    id: number
  }
}

// ============== 图片上传相关 ==============

// 图片上传响应数据
export interface UploadImageResponse extends ResponseData {
  data: {
    url: string
  }
}

